/* Global styles and reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
}

/* Main container - adapts to iframe or standalone */
#app-container {
    width: 100%;
    height: 450px;
    background: #f5f5f5;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Standalone mode - uses 90vh */
body.standalone #app-container {
    height: 90vh;
}

/* Info icon positioned at top-right */
.info-icon {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 24px;
    cursor: pointer;
    z-index: 100;
    transition: transform 0.2s;
}

.info-icon:hover {
    transform: scale(1.2);
}

/* Tooltip styling - centered display */
.tooltip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 400px;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
    line-height: 1.6;
}

.tooltip.hidden {
    display: none;
}

/* Progress bar at the top */
#progress-bar {
    background: #2c3e50;
    color: white;
    padding: 8px 15px;
    text-align: center;
    position: relative;
    font-weight: bold;
    font-size: 14px;
}

#progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #27ae60;
    transition: width 0.3s ease;
    opacity: 0.3;
}

#progress-text {
    position: relative;
    z-index: 1;
}

/* Main content layout - two columns */
#main-content {
    display: flex;
    gap: 15px;
    padding: 15px;
    height: calc(100% - 120px);
}

/* Items section (left side) */
#items-section {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

#items-section h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #2c3e50;
    text-align: center;
}

/* Items container - grid layout */
#items-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
}

/* Individual item styling */
.item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    cursor: grab;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    user-select: none;
    color: white;
    font-size: 12px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.item:active {
    cursor: grabbing;
}

.item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.item.correct {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
}

.item.incorrect {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.item.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.item-icon {
    font-size: 28px;
    margin-bottom: 5px;
}

.item-name {
    font-size: 11px;
    font-weight: 600;
}

/* Bag section (right side) */
#bag-section {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#bag-section h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #2c3e50;
    text-align: center;
}

/* Drop zone styling */
#drop-zone {
    background: #ecf0f1;
    border: 3px dashed #95a5a6;
    border-radius: 8px;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 15px;
    transition: all 0.3s;
    position: relative;
}

#drop-zone.drag-over {
    background: #d5dbdb;
    border-color: #3498db;
    transform: scale(1.02);
}

#bag-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

#drop-hint {
    color: #7f8c8d;
    font-size: 13px;
    text-align: center;
}

/* Packed items display */
#packed-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
    margin-top: 10px;
}

.packed-item {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 8px;
    border-radius: 6px;
    text-align: center;
    font-size: 11px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.packed-item-icon {
    font-size: 24px;
    margin-bottom: 3px;
}

.remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.remove-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* Feedback panel styles removed as per user request */

/* Controls section */
#controls {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

#controls button {
    background: #2c3e50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    height: auto;
}

#controls button:hover {
    background: #34495e;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#controls button:active {
    transform: translateY(0);
}

#submit-btn {
    background: #27ae60;
}

#submit-btn:hover {
    background: #229954;
}

/* Modal styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80%;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
}

#results-content {
    margin: 15px 0;
    line-height: 1.8;
}

.result-item {
    padding: 8px;
    margin: 5px 0;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-item.correct {
    background: #d5f4e6;
    color: #27ae60;
}

.result-item.incorrect {
    background: #fadbd8;
    color: #e74c3c;
}

.result-item.missed {
    background: #fef5e7;
    color: #f39c12;
}

#close-modal-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    width: 100%;
    margin-top: 10px;
}

#close-modal-btn:hover {
    background: #2980b9;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #main-content {
        flex-direction: column;
    }
    
    #items-container {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }
    
    #controls {
        flex-direction: column;
        width: 90%;
    }
    
    #controls button {
        width: 100%;
    }
}